﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

using System.Data.SqlClient;

namespace ConexionSQL
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        System.Data.SqlClient.SqlConnection con;

        private void Form1_Load(object sender, EventArgs e)
        {
            con = new System.Data.SqlClient.SqlConnection();
            con.ConnectionString = "Data Source=localhost\\SQLSERVER2005; Initial Catalog=GD1C2012; User ID = gd; Password = gd2012";
            try
            {
                con.Open();
                MessageBox.Show("Conexión realizada.");
            }
            catch (Exception)
            {
                MessageBox.Show("Conexión fallida.");
            }
        }
    }
}
